<div class="f-cb f-mb10"><h3 class="list-title">member数据</h3> <span class="f-fr"><a href="#!/?member/admin/member/addItem" class="f-btn f-btn-success">增加数据</a></span></div>
<div class="mkoa-box f-p10"  ms-controller="member-list">
    <mkoa:pager  url="member/admin/member/findAll" searchurl="member/admin/member/search" >
        <div slot="$top" id="search">
            <select ms-duplex="searchKey" class="f-fl" >
                <option value="id">ID</option>
                <option value="nickname">昵称</option><option value="pic">头像地址</option><option value="sex">性别</option><option value="type">类型【1:学生 2：老师】</option><option value="name">真实姓名</option><option value="openid">微信标识</option>
            </select>
            <input type="text" ms-duplex="searchValue" class="f-fl f-ml5"/>
            <button ms-click="search" class="f-btn f-btn-success f-ml10" >搜索</button>
            <button ms-if="searchOpen" ms-click="closeSearch" class="f-btn">清空搜索</button>
        </div>
        <table slot="$list" class="mkoa-table">
            <thead>
            <tr><th width="30">ID</th><th>昵称</th><th>头像地址</th><th>性别</th><th>类型【1:学生 2：老师】</th><th>真实姓名</th><th>微信标识</th><th width="155">创建时间</th><th width="100">操作</th></tr>
            </thead>
            <tbody>
            <tr ms-repeat="listData"><td>{{el.id}}</td><td>{{el.nickname}}</td><td>{{el.pic}}</td><td>{{el.sex}}</td><td>{{el.type}}</td><td>{{el.name}}</td><td>{{el.openid}}</td><td>{{el.createdAt|date("yyyy-MM-dd HH:mm:ss")}}</td>
           <td><a ms-attr-href="'#!/?member/admin/member/addItem?id='+el.id"  class="f-btn f-btn-sm">编辑</a> <button  ms-click="remove($remove,el.id)" class="f-btn f-btn-sm">删除</button></td>
            </tr>
            </tbody>
        </table>
    </mkoa:pager>
</div>
<script>
    require(["mkoaAjax/mkoaAjax","mkoaPagerFull/mkoaPagerFull"], function ($a){
       avalon.define({
            $id:'member-list',
            remove:function($remove,id){
                $a.getJSON(app.$host +'member/admin/member/delete',{id:id},function(data){//删除数据
                    if(!data.error){
                        $remove();
                    }
                });
            }
        });
        avalon.scan();
    });
</script>